import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);
const router = new VueRouter({
  mode: "hash",
  routes: [
    //登录路由
    {
      path: "/login",
      name: "Login",
      component: () => import("@/views/login/index.vue"),
      meta: {
        title: "登录",
        showbread: false,
      },
    },

    //主布局路由
    {
      path: "/",
      component: () => import("@/layout/index.vue"), //使用布局组件作为容器
      meta: {
        showbread: false,
      },
      children: [
        //首页
        {
          path: "",
          name: "Home", //命名路由
          component: () => import("@/views/home/index.vue"),
          meta: {
            title: "首页",
            showbread: true,
          },
        },
        //教务管理
        {
          path: "education",
          name: "Education",
          component: () => import("@/views/education/index.vue"), //教育管理容器
          meta: {
            title: "教务管理",
            showbread: true,
          },
          children: [
            {
              //基础信息维护
              path: "baseImage",
              name: "BaseImage",
              component: () => import("@/views/education/baseImage/index.vue"),
              meta: {
                title: "学年学科配置",
                showbread: true,
              },
            },
            {
              //编辑栏
              path: "baseInfo",
              name: "BaseInfo",
              component: () =>
                import("@/views/education/baseImage/baseInfo/index.vue"),
            },
            //教师管理
            {
              path: "teaching",
              name: "Teaching",
              component: () => import("@/views/education/teacher/index.vue"),
              meta: {
                title: "教师管理",
                showbread: true,
              },
            },
            //编辑教师
            {
              path: "editTeacher",
              name: "EditTeacher",
              component: () =>
                import("@/views/education/teacher/editTeacher.vue"),
              meta: {
                title: "编辑教师",
                showbread: true,
              },
            },
            //班级管理
            {
              path: "classManage",
              name: "ClassManage",
              component: () =>
                import("@/views/education/classManage/index.vue"),
              meta: {
                title: "班级管理",
                showbread: true,
              },
            },
            //编辑班级
            {
              path:"editClass",
              name:"EditClass",
              component:()=>import("@/views/education/classManage/editClass.vue"),
              meta:{
                title:"编辑班级",
                showbread:true,
              }
            },
            //学生管理
            {
              path: "studentManage",
              name: "StudentManage",
              component: () =>
                import("@/views/education/studentManage/index.vue"),
              meta: {
                title: "学生管理",
                showbread: true,
              },
            },
            //年级主任维护
            {
              path: "gradeDirector",
              name:"GradeDirector",
              component:()=>import("@/views/education/gradeDirector/index.vue"),
              meta:{
                title:"年级主任维护",
                showbread:true,
              }
            },
            //排课维护
            {
              path: "classProtect",
              name:"ClassProtect",
              component:()=>import("@/views/education/classProtect/index.vue"),
              meta:{
                title:"班级维护",
                showbread:true,
              }
            },
            //增加排课
            {
              path: "addClass",
              name:"AddClass",
              component:()=>import("@/views/education/classProtect/addClass.vue"),
              meta:{
                title:"增加排课",
                showbread:true,
              }
            },
            //增加排课1
            {
              path: "addClass2",
              name:"AddClass2",
              component:()=>import("@/views/education/classProtect/addClass2.vue"),
              meta:{
                title:"增加排课2",
                showbread:true,
              }
            }
          ],
        },
      ],
    },
  ],
});
router.beforeEach((to, from, next) => {
  console.log("即将跳转至", to.path);
  console.log("从哪里跳", from.path);
  next();
});
router.afterEach((to, from) => {
  console.log("跳转完成", to.path);
  console.log("从哪里跳", from.path);
});
export default router;
